package init

import (
	"discount-service/basic/config"
	"fmt"
	"log"

	"github.com/spf13/viper"
)

func InitsConfig() {
	viper.SetConfigFile("../../config.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic(fmt.Sprintf("配置读取失败%v", err))
		return
	}
	log.Println("配置读取成功")
	err = viper.Unmarshal(&config.AppConf)
	if err != nil {
		panic(fmt.Sprintf("配置解析失败%v", err))
		return
	}
	log.Println(config.AppConf)
	log.Println("配置解析成功")
}
